﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace ALE_Server.EC
{
    [Serializable]
    [DataContract]
    public class ECReports
    {
        private string m_SpecName;
        private DateTime m_DateTime;
        private string m_ALEID;
        private long m_TotalMillisSeconds;
        private ECTerminationCondition m_TerminationCondition;
        private ECSpec m_Spec;
        private IList<ECReport> m_Reports = new List<ECReport>();

        public ECReports()
        {
        }
       
        public ECReports(string specName)
        {
            m_SpecName = specName;
        }

        [DataMember]
        public string SpecName
        {
            get
            {
                return m_SpecName;
            }
            set
            {
                m_SpecName = value;
            }
        }

        [DataMember]
        public DateTime Date
        {
            get
            {
                return m_DateTime;
            }
            set
            {
                m_DateTime = value;
            }
        }

        [DataMember]
        public long TotalMillisSeconds
        {
            get
            {
                return m_TotalMillisSeconds;
            }
            set
            {
                m_TotalMillisSeconds = value;
            }
        }

        [DataMember]
        public string ALEID
        {
            get
            {
                return m_ALEID;
            }
            set
            {
                m_ALEID = value;
            }
        }

        [DataMember]
        public ECTerminationCondition TerminationCondition
        {
            get
            {
                return m_TerminationCondition;
            }
            set
            {
                m_TerminationCondition = value;
            }
        }

        [DataMember]
        public ECSpec Spec
        {
            get
            {
                return m_Spec;
            }
            set
            {
                m_Spec = value;
            }
        }

        [DataMember]
        public IList<ECReport> Reports
        {
            get
            {
                return m_Reports;
            }
            set
            {
                m_Reports = value;
            }
        }

        public void AddECReport(ECReport report)
        {
            if (report != null)
            {
                m_Reports.Add(report);
            }
        }

        public void RemoveECReport(ECReport report)
        {
            if (report != null)
            {
                m_Reports.Remove(report);
            }
        }

        public override string ToString()
        {
            return XmlSerializeHelper.Serialize(this);
        }
    }
}
